<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=jYaBAHQejLwjG5LCM88MZQgv7N4oBGPZ"></script>
    <title>单个地址解析</title>
    <style>
       body,html{
           width: 100%;
           height: 100%;
           padding: 0;
           margin: 0;
       }
       #container{
           width: 100%;
           height: 100%;
           overflow: hidden;
       }
       #result{
           position: fixed;
           top: 10px;
           left: 10px;
           width: 250px;
           height: 30px;
           line-height: 30px;
           text-align: center;
           background: #fff;
           box-shadow: 0 2px 6px 0 rgba(27, 142, 236, 0.5);
           border-radius: 7px;
           z-index: 99;
       }
    </style>
</head>
<body>
    <div id='container'></div>
    <div id='result'>山东省威海市环翠区昆仑路110号</div>
    <script>
        var map = new BMapGL.Map('container');
        map.centerAndZoom(new BMapGL.Point(116.331398,39.897445), 12);
        //创建地址解析器实例
        var myGeo = new BMapGL.Geocoder();
        // 将地址解析结果显示在地图上，并调整地图视野
        myGeo.getPoint('湖北省十堰市佰昌物流区2-14.15.16.17.32.33.34.35号', function(point){
            if(point){
                console.log(JSON.stringify(point))
                map.centerAndZoom(point, 16);
                map.addOverlay(new BMapGL.Marker(point, {title: '湖北省十堰市佰昌物流区2-14.15.16.17.32.33.34.35号'}))
            }else{
                alert('您选择的地址没有解析到结果！');
            }
        }, '北京市')



        var warehoselist=[ "四川省成都市新都区柏水路明福仓库" 
]
        console.log(warehoselist.length) 
        warehoselist

        warehoselist.forEach(element => {
            myGeo.getPoint(element, function(point){
            if(point){
                console.log("update t_warehouse_base_info SET coordinate='"+JSON.stringify(point)+"' WHERE detail_address='"+element+"'")
               
            }else{
                alert('您选择的地址没有解析到结果！');
            }
        }, '北京市')
        });
    </script>
</body>
</html>